package com.ym.medical.service.impl;

import cn.hutool.extra.spring.SpringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ym.base.enums.FlagEnum;
import com.ym.common.constant.Coder;
import com.ym.common.enums.UserUserTypeEnum;
import com.ym.core.exception.BusinessException;
import com.ym.core.shiro.ShiroUtil;
import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.core.utils.tkmybatis.TK;
import com.ym.medical.dao.AccountDao;
import com.ym.medical.dao.DoctorDetailsDao;
import com.ym.medical.dao.DoctorLabelDao;
import com.ym.medical.dao.DoctorServiceItemDao;
import com.ym.medical.dao.LabelsDao;
import com.ym.medical.domain.entity.*;
import com.ym.medical.domain.param.DoctorDetailsParam;
import com.ym.medical.domain.param.DoctorServicePriceUpdateParam;
import com.ym.medical.domain.param.LabelsParam;
import com.ym.medical.domain.param.StudioPersonnelParam;
import com.ym.medical.domain.vo.DoctorAddVo;
import com.ym.medical.domain.vo.DoctorAuditRecordVo;
import com.ym.medical.domain.vo.DoctorDetailListVo;
import com.ym.medical.domain.vo.DoctorDetailsVo;
import com.ym.medical.domain.vo.LabelsVo;
import com.ym.medical.enums.*;
import com.ym.medical.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 *
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DoctorDetailSVImpl extends BaseSVImpl<DoctorDetailsEntity, DoctorDetailsDao> implements IDoctorDetailSV {

	private static Logger logger = LoggerFactory.getLogger(DoctorDetailSVImpl.class);

	@Autowired
	private IUserSV userSV;

	@Autowired
	private AccountDao accountDao;

	@Autowired
	private DoctorLabelDao doctorLabelDao;

	@Autowired
	private LabelsDao labelsDao;

	@Autowired
	private ISysSignSV iSysSignSV;

	@Autowired
	private IAddressGroupSV iAddressGroupSV;

	@Autowired
	private IDoctorLabelSV doctorLabelSV;

	@Autowired
	@Lazy
	private IDoctorStudioSV iDoctorStudioSV;

	@Autowired
	private DoctorServiceItemDao doctorServiceItemDao;

	@Autowired
	private ITextRuleSV iTextRuleSV;

	@Autowired
	private IDoctorServicePriceSV iDoctorServicePriceSV;

	@Autowired
	private IStudioPersonnelSV iStudioPersonnelSV;

	@Autowired
	private ISysDictSV iSysDictSV;

	@Autowired
	private ILabelsSV iLabelsSV;


	/**
	 * 医生信息列表
	 *
	 * @param pageNo
	 * @param limit
	 * @param doctorDetailsModel
	 * @return
	 */
	@Override
	public PageInfo<DoctorDetailListVo> getDoctorDetailList(
			int pageNo, int limit, DoctorDetailsParam doctorDetailsModel) {
		if (null == doctorDetailsModel) {
			throw new BusinessException(Coder.System.BAD_REQUEST);
		}
		PageHelper.startPage(pageNo, limit);
		List<DoctorDetailListVo> doctorDetailVos = mapper.getDoctorDetailList(doctorDetailsModel);
		PageInfo<DoctorDetailListVo> doctorDetailVoPageInfo = new PageInfo<>(doctorDetailVos);
		return doctorDetailVoPageInfo;
	}

	/**
	 * 删除医生信息
	 *
	 * @param doctorIds 医生 long[]
	 * @return
	 */
	@Override
	public int deleteDoctor(Long[] doctorIds) {
		if (StringUtils.isEmpty(doctorIds)) {
			throw new BusinessException("至少选择一个医生");
		}
		int rows = 0;
		//医生表
		this.deleteByIds(doctorIds);
		//标签关系表
		doctorLabelSV.deleteByParams(
				TK.selectWhere(DoctorLabelEntity.class)
						.andIn(DoctorLabelEntity::getDoctId, doctorIds)
				.end()
		);
		//删除用户表
		rows = userSV.deleteByIds(doctorIds);
		return rows;
	}


	/**
	 * 医生所有信息列表
	 *
	 * @return
	 */
	@Override
	public PageInfo<DoctorDetailsEntity> getAllDoctorList(int pageNo, int limit, DoctorDetailsParam model) {
		PageHelper.startPage(pageNo, limit);
		List<DoctorDetailsEntity> doctorDetails = mapper.getAllDoctorList(model);
		if (doctorDetails.isEmpty()) {
			throw new BusinessException("没有您要的数据");
		}
		return new PageInfo<>(doctorDetails);
	}

	/**
	 * 新增医生
	 *
	 * @param currId
	 * @param addVo  医生对象
	 * @return
	 */
	@Override
	public int addDoctor(DoctorAddVo addVo, Long currId) {
		DoctorDetailsParam doctorDetailsModel = addVo.getModel();
		if (null == doctorDetailsModel) {
			throw new BusinessException("新增对象不能为空");
		}
		if (StringUtils.isEmpty(doctorDetailsModel.getDoctCode())) {
			throw new BusinessException("医生编码不能为空");
		}
		if (StringUtils.isEmpty(doctorDetailsModel.getPhoneNo())) {
			throw new BusinessException("医生电话不能为空");
		}
		// 查询账号是否存在
		boolean add = false;
		try {
			UserEntity u = SpringUtil.getBean(IUserSV.class).existingUser(doctorDetailsModel.getPhoneNo(), UserUserTypeEnum.DOCTOR.getKey());
		} catch (Exception e) {
			add = true;
		}
		if (!add) {
			throw new BusinessException("该电话已经被使用");
		}

		String salt = UUID.randomUUID().toString().replace("-", "");
		String pwd = ShiroUtil.genHashPass("123456", salt);
		UserEntity user = new UserEntity();
		user.setCreateTime(new Date());
		user.setModifyTime(new Date());
		user.setRealName(doctorDetailsModel.getRealName());
		user.setSex(doctorDetailsModel.getSex());
		user.setHeadUrl(doctorDetailsModel.getHeadUrl());
		user.setPhoneNo(doctorDetailsModel.getPhoneNo());
		user.setCardType(doctorDetailsModel.getCardType());
		user.setCardNo(doctorDetailsModel.getCardNo());
		user.setUserPwd(pwd);
		user.setSalt(salt);
		user.setCertState(UserCertStateEnum.UNAUTHORIZED.getKey());
		user.setUserState(UserUserStateEnum.NORMAL.getKey());
		user.setUserType(UserUserTypeEnum.DOCTOR.getKey());
		userSV.insert(user);
		Long userId = user.getId();

		//签名
		SysSignEntity sysSign = iSysSignSV.createSign(OrgSignEnum.DOCTORS);
		Long signId = sysSign.getId();
		user.setSignId(signId);
		userSV.updateById(user);

		//同时创建医生账户
		AccountEntity account = new AccountEntity();
		account.setUserId(userId);
		account.setAccBalance(BigDecimal.valueOf(0.00));
		account.setFreezeBalance(BigDecimal.valueOf(0.00));
		accountDao.insertSelective(account);

		//云信账号
		SpringUtil.getBean(IYunxinUserSV.class).createYxUserAccount(user);

		/*全科医生工作室相关*/
		doctAssociatedItem(doctorDetailsModel, userId);
		//通讯录初始化
		createDoctAddressBook(userId);
		//医生编码需要校验是否存在?
		doctorDetailsModel.setCreateTime(new Date());
		doctorDetailsModel.setModifyTime(new Date());
		doctorDetailsModel.setId(userId);
		doctorDetailsModel.setQualificationStatus(UserCertStateEnum.UNAUTHORIZED.getKey());
		this.insert(doctorDetailsModel.covert());
		Long doctId = doctorDetailsModel.getId();
		//医生标签添加


		List<DoctorLabelEntity> goods = doctorDetailsModel.getDoctorLabels();
		if (!goods.isEmpty()) {
			for (DoctorLabelEntity lab1 : goods) {
				lab1.setDoctId(doctId);
			}
			doctorLabelSV.batchInsert(goods);
		}
		/*List<DoctorLabel> doctorLabels = doctorDetailsModel.getDoctorLabels();
		List<String> doctorGoods = addVo.getDoctorGoods();

		if (doctorLabels != null) {
			for (DoctorLabel doctorLabel : doctorLabels) {
				doctorLabel.setDoctId(doctId);
				doctorLabelSV.save(doctorLabel);
			}
		}
		if (doctorGoods != null){
			for (String str : doctorGoods){
				addJobTitle(doctId,str,currId);
			}
		}*/
		return 1;
	}

	/**
	 * 医生关联项创建
	 */
	private void doctAssociatedItem(DoctorDetailsParam doctorDetailsModel, Long userId) {
		///判断是否开通工作室
		DoctorStudioEntity doctorStudio = iDoctorStudioSV.selectOne(DoctorStudioEntity.builder().belongPerson(userId).build());
		if (doctorStudio != null) {
			return;
		}
		//全科医生开通工作室  开通图文问诊
		if (CounsellingRoomCourTypeEnum.GENERAL.getKey()
				.equals(doctorDetailsModel.getDoctCategory())) {
			//工作室
			DoctorStudioEntity studio = new DoctorStudioEntity();
			studio.setBelongPerson(userId);
			studio.setDsName(doctorDetailsModel.getRealName() + "的工作室");
			studio.setDescription("systemOpen");
			studio.setState(DoctorStudioStatusEnum.OPEN.getKey());
			studio.setCreateTime(new Date());
			iDoctorStudioSV.insert(studio);
			//将自己放入工作室
			StudioPersonnelParam model = StudioPersonnelParam.builder()
					.dsId(studio.getId()).doctId(userId).admsStateDoctor(FlagEnum.IS.getKey())
					.admsStateStudio(FlagEnum.IS.getKey()).build();
			iStudioPersonnelSV.insert(model.covert());
			//服务项
			DoctorServiceItemEntity serviceItem = new DoctorServiceItemEntity();
			serviceItem.setDoctId(userId);
			//开启
			serviceItem.setIsOpen(FlagEnum.IS.getKey());
			//图文
			serviceItem.setSeriLabel(DoctorServiceItemEnum.BY_INQUIRING.getKey());
			doctorServiceItemDao.insertSelective(serviceItem);
			//工作室申请记录
			//免费 且30 次服务
			TextRuleEntity textRule = iTextRuleSV.selectRule();
			TextRuleEntity rule = null;
			if (null == textRule) {
				rule = new TextRuleEntity();
				rule.setIsDefault(FlagEnum.IS.getKey());
				rule.setTrRound(30);
				rule.setTrName("默认规则");
				iTextRuleSV.insert(rule);
			}
			DoctorServicePriceUpdateParam model2 = DoctorServicePriceUpdateParam.builder()
					//服务项id/价格/生效时间/规则id/状态/
					.doctId(userId).seriLabel(DoctorServiceItemEnum.BY_INQUIRING.getKey())
					.dspPrice(BigDecimal.valueOf(0.00))
					.validTime(new Date()).createTime(new Date())
					.ruleId(textRule.getId() == null ? rule.getId() : textRule.getId())
					.state(FlagEnum.IS.getKey()).build();
			iDoctorServicePriceSV.insertPC(model2);
		}
	}


	/**
	 * 医生信息更改
	 *
	 * @param updateVo
	 * @return
	 */
	@Override
	public int updateDoctor(DoctorAddVo updateVo, Long currId) {
		int rows = 0;
		DoctorDetailsParam doctorDetailsModel = updateVo.getModel();
		UserEntity user = new UserEntity();
		user.setModifyTime(new Date());
		user.setId(doctorDetailsModel.getId());
		user.setRealName(doctorDetailsModel.getRealName());
		user.setSex(doctorDetailsModel.getSex());
		user.setPhoneNo(doctorDetailsModel.getPhoneNo());
		user.setCardType(doctorDetailsModel.getCardType());
		user.setCardNo(doctorDetailsModel.getCardNo());
		Long doctId = doctorDetailsModel.getId();
		try {
			userSV.updateById(user);
		} catch (Exception e) {
			logger.info("DoctorDetailSVImpl updateDoctor", e.getMessage());
			if (e instanceof DuplicateKeyException) {
				throw new BusinessException("电话号已经被使用");
			}
		}

		//医生编码需要校验是否存在?
		DoctorDetailsEntity details = repeatHosCode(doctId, doctorDetailsModel.getDoctCode());
		if (details != null) {
			throw new BusinessException("医生编码已存在");
		}
		doctorDetailsModel.setModifyTime(new Date());
		rows = this.updateById(doctorDetailsModel.covert());
		//全科且 A 开通工作室
		doctAssociatedItem(doctorDetailsModel, doctId);
		//医生标签添加 擅长
		List<DoctorLabelEntity> doctorLabels = doctorDetailsModel.getDoctorLabels();
		//01 擅长 02 普通
		Long[] labIds2 = doctorLabelSV.selectLabIds(doctId, "01");
		if (!doctorLabels.isEmpty()) {

			if (labIds2 != null && labIds2.length > 0) {
				doctorLabelSV.deleteByParams(
						TK.selectWhere(DoctorLabelEntity.class)
								.andEqualTo(DoctorLabelEntity::getDoctId, doctId)
								.andIn(DoctorLabelEntity::getLabId, labIds2)
						.end()
				);
			}
			for (DoctorLabelEntity doctorLabel : doctorLabels) {
				doctorLabel.setDoctId(doctorDetailsModel.getId());
			}
			doctorLabelSV.batchInsert(doctorLabels);
		}
		if (doctorLabels.isEmpty() && labIds2 != null && labIds2.length > 0) {
			doctorLabelSV.deleteByParams(
					TK.selectWhere(DoctorLabelEntity.class)
							.andEqualTo(DoctorLabelEntity::getDoctId, doctId)
							.andIn(DoctorLabelEntity::getLabId, labIds2)
					.end()
			);
		}
		//List<String> goods = updateVo.getDoctorGoods();
		//普通标签
		List<DoctorLabelEntity> normals = doctorDetailsModel.getNormals();
		Long[] labIds = doctorLabelSV.selectLabIds(doctId, "02");
		if (!normals.isEmpty()) {


			//Long [] labIds = labIds(doctorLabel);
			//删除表关系
			if (labIds != null && labIds.length > 0) {
				doctorLabelSV.deleteByParams(
						TK.selectWhere(DoctorLabelEntity.class)
								.andEqualTo(DoctorLabelEntity::getDoctId, doctId)
								.andIn(DoctorLabelEntity::getLabId, labIds)
						.end()
				);
			}
			for (DoctorLabelEntity label2 : normals) {
				label2.setDoctId(doctorDetailsModel.getId());
			}
			doctorLabelSV.batchInsert(normals);
		}
		if (normals.isEmpty() && labIds != null && labIds.length > 0) {
			doctorLabelSV.deleteByParams(
					TK.selectWhere(DoctorLabelEntity.class)
							.andEqualTo(DoctorLabelEntity::getDoctId,doctId)
							.andIn(DoctorLabelEntity::getLabId, labIds)
					.end()
			);
		}

		return rows;
	}


	/**
	 * 医内医生编码是否重复
	 *
	 * @return
	 */
	protected DoctorDetailsEntity repeatHosCode(Long doctId, String doctCode) {
		return mapper.repeatHosCode(doctId, doctCode);
	}


	/**
	 * labId 返回
	 *
	 * @param labels
	 * @return
	 */
	private Long[] labIds(List<DoctorLabelEntity> labels) {
		Long[] labId = new Long[labels.size()];
		for (int i = 0; i < labels.size(); i++) {
			labId[i] = labels.get(i).getLabId();
		}
		return labId;
	}

	/**
	 * 医生导入
	 *
	 * @param doctorDetailsList
	 * @return
	 */
	@Override
	public Map<String, Object> importDoctor(List<DoctorDetailsParam> doctorDetailsList) {
		Map<String, Object> map = new HashMap<>();
		List<DoctorDetailsParam> failList = new ArrayList<>();
		List<DoctorDetailsParam> updateList = new ArrayList<>();
		int rows = 0;
		int updateCount = 0;
		for (DoctorDetailsParam doctorDetailsModel : doctorDetailsList) {

			if (StringUtils.isEmpty(doctorDetailsModel.getDoctCode())
					&& StringUtils.isEmpty(doctorDetailsModel.getPhoneNo())) {
				failList.add(doctorDetailsModel);
				continue;
			}
			//各类枚举翻译
			translate(doctorDetailsModel);
			String salt = UUID.randomUUID().toString().replace("-", "");
			String pwd = ShiroUtil.genHashPass("123456", salt);
			UserEntity user = new UserEntity();
			user.setCreateTime(new Date());
			user.setModifyTime(new Date());
			user.setRealName(doctorDetailsModel.getRealName());
			user.setSex(doctorDetailsModel.getSex());
			user.setPhoneNo(doctorDetailsModel.getPhoneNo());
			user.setCardType(doctorDetailsModel.getCardType());
			user.setCardNo(doctorDetailsModel.getCardNo());
			user.setUserPwd(pwd);
			user.setSalt(salt);
			user.setCertState(UserCertStateEnum.UNAUTHORIZED.getKey());
			user.setUserState(UserUserStateEnum.NORMAL.getKey());
			user.setUserType(UserUserTypeEnum.DOCTOR.getKey());
			try {
				userSV.insert(user);
				Long userId = user.getId();

				//创建签名
				SysSignEntity sysSign = iSysSignSV.createSign(OrgSignEnum.DOCTORS);
				Long signId = sysSign.getId();
				user.setSignId(signId);
				userSV.updateById(user);

				//同时创建医生账户
				AccountEntity account = new AccountEntity();
				account.setUserId(userId);
				account.setAccBalance(BigDecimal.valueOf(0.00));
				account.setFreezeBalance(BigDecimal.valueOf(0.00));
				accountDao.insertSelective(account);

				//云信账号
				SpringUtil.getBean(IYunxinUserSV.class).createYxUserAccount(user);

				//医生通讯录初始化
				createDoctAddressBook(userId);
				/*医生各类关联项*/
				doctAssociatedItem(doctorDetailsModel, userId);
				//医生工作室?

				//医生编码需要校验是否存在
				doctorDetailsModel.setCreateTime(new Date());
				doctorDetailsModel.setModifyTime(new Date());
				doctorDetailsModel.setId(userId);
				doctorDetailsModel.setQualificationStatus(UserCertStateEnum.UNAUTHORIZED.getKey());
				this.insert(doctorDetailsModel.covert());
			} catch (Exception e) {
				logger.info("DoctorDetailSVImpl importDoctor", e.getMessage());
				if (e instanceof DuplicateKeyException) {
					//姓名手机号查询用户
					UserEntity user1 = userSV.selectByNameAndPh(doctorDetailsModel.getRealName(), doctorDetailsModel.getPhoneNo());
					user.setId(user1.getId());
					updateCount = userSV.updateById(user);
					updateList.add(doctorDetailsModel);
				}
			}
		}
		map.put("successCount", rows);
		map.put("updateDetail", updateList);
		map.put("failDetail", failList);
		return map;
	}

	/**
	 * 医生枚举值翻译
	 *
	 * @param model
	 */
	private void translate(DoctorDetailsParam model) {
		Map<String, String> sexMap = iSysDictSV.getDictValuesToMap(UserSexEnum.class);
		Map<String, String> sexMapTrans = new HashMap<>();
		sexMap.forEach((key, value) -> {
			sexMapTrans.put(value, key);
		});
		Map<String, String> categoryMap = iSysDictSV.getDictValuesToMap(CounsellingRoomCourTypeEnum.class);
		Map<String, String> categoryMapTrans = new HashMap<>();
		categoryMap.forEach((key, value) -> {
			categoryMapTrans.put(value, key);
		});
		Map<String, String> doctTypeMap = iSysDictSV.getDictValuesToMap(DoctorDetailsDoctTypeEnum.class);
		Map<String, String> doctTypeMapTrans = new HashMap<>();
		doctTypeMap.forEach((key, value) -> {
			doctTypeMapTrans.put(value, key);
		});
		Map<String, String> cardTypeMap = iSysDictSV.getDictValuesToMap(UserCardTypeEnum.class);
		Map<String, String> cardTypeMapTrans = new HashMap<>();
		cardTypeMap.forEach((key, value) -> {
			cardTypeMapTrans.put(value, key);
		});

		Map<String, String> jobTitleMap = iSysDictSV.getDictValuesToMap(DoctorJobTitle.class);
		Map<String, String> jobTitleMapTrans = new HashMap<>();
		jobTitleMap.forEach((key, value) -> {
			jobTitleMapTrans.put(value, key);
		});

		//性别翻译
		model.setSex(sexMapTrans.get(model.getSex()));
		//科别翻译
		model.setDoctCategory(categoryMapTrans.get(model.getDoctCategory()));
		//医生级别翻译
		model.setDoctType(doctTypeMapTrans.get(model.getDoctType()));
		//证件类型翻译
		model.setCardType(cardTypeMapTrans.get(model.getCardType()));
		//职称翻译
		model.setJobTitle(jobTitleMapTrans.get(model.getJobTitle()));


	}

	/**
	 * 医生标签 添加
	 *
	 * @param doctId 医生id
	 * @param label  标签数组
	 * @return
	 */
	@Override
	public int addJobTitle(Long doctId, String label, Long currId) {
		if (StringUtils.isEmpty(doctId)) {
			throw new BusinessException("医生id不能为空");
		}
		if (StringUtils.isEmpty(label)) {
			throw new BusinessException("请输入标签内容");
		}
		LabelsEntity lab = new LabelsEntity();
		lab.setDlType("01");
		lab.setDlValue(label);
		lab.setCreateSb(currId);
		labelsDao.insertSelective(lab);
		Long labId = lab.getId();
		DoctorLabelEntity doctorLabel = new DoctorLabelEntity();
		doctorLabel.setLabId(labId);
		doctorLabel.setDoctId(doctId);
		int rows = doctorLabelDao.insertSelective(doctorLabel);
		return rows;
	}

	/***
	 * 删除标签
	 * @param labId
	 * @return
	 */
	@Override
	public int deleteJobTitle(Long labId) {
		labelsDao.deleteByPrimaryKey(labId);
		int rows = doctorLabelDao.deleteByLabId(labId);
		return rows;
	}

	/**
	 * @param doctId
	 * @return
	 */
	@Override
	public List<LabelsEntity> selectJobTitle(Long doctId) {
		List<LabelsEntity> labelsList = labelsDao.selectJobTitle(doctId);
		return labelsList;
	}

	/***
	 * 医生通讯录初始化
	 * @param userId
	 */
	@Override
	public void createDoctAddressBook(Long userId) {
		SystemGroupEnum.PATIENT[] values = SystemGroupEnum.PATIENT.values();
		for (SystemGroupEnum.PATIENT value : values) {

			AddressGroupEntity addressGroup = new AddressGroupEntity();
			addressGroup.setAlgName(value.getName());
			addressGroup.setUserId(userId);
			//系统创建
			addressGroup.setAlgType(AddressGroupAlgTypeEnum.System.getKey());
			//患者
			addressGroup.setAlgIdent(AddressGroupAlgIdentEnum.IN_PATIENTS_WITH.getKey());
			iAddressGroupSV.insert(addressGroup);
			//System.out.println(value.getName());
		}
		String doctorGroup = SystemGroupEnum.DOCTOR.ALL.getName();
		AddressGroupEntity addressGroup = new AddressGroupEntity();
		addressGroup.setAlgName(doctorGroup);
		addressGroup.setUserId(userId);
		//系统创建
		addressGroup.setAlgType(AddressGroupAlgTypeEnum.System.getKey());
		//医生
		addressGroup.setAlgIdent(AddressGroupAlgIdentEnum.THE_DOCTOR.getKey());
		iAddressGroupSV.insert(addressGroup);

	}

	/**
	 * 医生添加校验医生编码(安医院)
	 *
	 * @param doctCode
	 * @return
	 */
	@Override
	public DoctorDetailsEntity repeatDoctCode(String doctCode, String hosCode) {
		DoctorDetailsEntity details = mapper.repeatDoctCode(doctCode, hosCode);
		if (details != null) {
			throw new BusinessException("医生编码重复");
		}
		return null;
	}

	/**
	 * 医生名下拉搜索
	 *
	 * @param hosName
	 * @param doctName
	 * @return
	 */
	@Override
	public List<DoctorDetailsVo> searchDoctName(String hosName, String doctName) {
		List<DoctorDetailsVo> details = mapper.searchDoctName(hosName, doctName);
		return details;
	}

	/**
	 * 审核列表
	 *
	 * @param auditRecordVo
	 * @param pageNo
	 * @param limit
	 * @return
	 */
	@Override
	public PageInfo<DoctorAuditRecordVo> certRecordList(int pageNo, int limit, DoctorAuditRecordVo auditRecordVo) {
		PageHelper.startPage(pageNo, limit);
		List<DoctorAuditRecordVo> auditRecordVos = mapper.certRecordList(auditRecordVo);
		return new PageInfo<>(auditRecordVos);
	}

	/**
	 * 医生擅长所有标签
	 *
	 * @return
	 */
	@Override
	public List<LabelsVo> selectGoods(LabelsParam labelsModel) {
		return iLabelsSV.listLabels(labelsModel);
	}
}


